<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册成功</title>

</head>
<body>
注册成功，3秒后跳回首页~ <span id="sp" style="color: red"></span>...
<script type="text/javascript">
    onload = function () {
        setInterval(go, 1000);
    };
    var x = 3; //利用了全局变量来执行
    function go() {
        x--;
        if (x > 0) {
            document.getElementById("sp").innerHTML = x;  //每次设置的x的值都不一样了。
        } else {
            location.href = '/';
        }
    }
</script>
</body>
</html>